# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=setuptools-scm
pkgbase="python-${_realname}"
pkgname=("python-${_realname}")
pkgver=4.1.2
pkgrel=1
pkgdesc="Handles managing your python package versions in scm metadata"
arch=('any')
license=('MIT')
url='https://github.com/pypa/setuptools_scm'
depends=('python')
makedepends=('python-setuptools')
provides=("python3-${_realname}")
replaces=("python3-${_realname}")
conflicts=("python3-${_realname}")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname/-/_}-${pkgver}.tar.gz"
        0001-python-setuptools-scm-3.1.0-fix-path-error.patch)
sha256sums=('a8994582e716ec690f33fec70cca0f85bd23ec974e3f783233e4879090a7faa8'
            '3a936600ebceccf2315fe76a79e90e4fdcfe2a936b442f6321b2d76a8e9902b1')

prepare() {
  cd "${srcdir}/${_realname/-/_}-${pkgver}"
  patch -p1 -i ${srcdir}/0001-python-setuptools-scm-3.1.0-fix-path-error.patch
}

build() {
  cd "${srcdir}/${_realname/-/_}-${pkgver}"
  /usr/bin/python setup.py build
}

package() {
  cd "${srcdir}/${_realname/-/_}-${pkgver}"
  /usr/bin/python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1
  install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
